package cn.easyutil.util.platform.alibaba.alipay.bean;

import java.io.Serializable;

import cn.easyutil.util.javaUtil.StringUtil;

/**
 * 支付宝支付业务请求参数
 * @author spc
 *
 */
public class AliPayBizParamBean implements Serializable{

	private static final long serialVersionUID = 1L;
	/** 交易成功后跳转地址*/
	private String returnUrl;
	/** 交易成功后回调地址*/
	private String notifyUrl;
	/** 商户生成的订单编号*/
	private String outTradeNo;
	/** 交易金额，元*/
	private double totalAmount;
	/** 交易说明*/
	private String body;
	/** 拓展字段，支付宝回调时原样返回*/
	private String passbackParams;
	/** 商品类型  0：虚拟商品  1：实体商品*/
	private String goodsType;
	/** 商品标题*/
	private String subject;
	
	public AliPayBizParamBean(){}
	
	public AliPayBizParamBean(String subject,double totalAmount,String outTradeNo,String notifyUrl){
		this.subject = subject;
		this.totalAmount = totalAmount;
		this.outTradeNo = outTradeNo;
		this.notifyUrl = notifyUrl;
	}
	
	public String getReturnUrl() {
		return returnUrl;
	}
	public AliPayBizParamBean setReturnUrl(String returnUrl) {
		this.returnUrl = returnUrl;
		return this;
	}
	public String getNotifyUrl() {
		return notifyUrl;
	}
	public AliPayBizParamBean setNotifyUrl(String notifyUrl) {
		this.notifyUrl = notifyUrl;
		return this;
	}
	public String getOutTradeNo() {
		return outTradeNo;
	}
	public AliPayBizParamBean setOutTradeNo(String outTradeNo) {
		this.outTradeNo = outTradeNo;
		return this;
	}
	public double getTotalAmount() {
		return totalAmount;
	}
	public AliPayBizParamBean setTotalAmount(double totalAmount) {
		this.totalAmount = totalAmount;
		return this;
	}
	public String getBody() {
		return body;
	}
	public AliPayBizParamBean setBody(String body) {
		this.body = body;
		return this;
	}
	public String getPassbackParams() {
		return passbackParams;
	}
	public AliPayBizParamBean setPassbackParams(String passbackParams) {
		this.passbackParams = passbackParams;
		return this;
	}
	public String getGoodsType() {
		return goodsType;
	}
	public AliPayBizParamBean setGoodsType(String goodsType) {
		this.goodsType = goodsType;
		return this;
	}
	public String getSubject() {
		return subject;
	}
	public AliPayBizParamBean setSubject(String subject) {
		this.subject = subject;
		return this;
	}
	
	public boolean check(){
		if(StringUtil.isEmpty(this)){
			return false;
		}
		if(this.getTotalAmount()<=0){
			return false;
		}
		if(StringUtil.isEmpty(this.getSubject()) || StringUtil.isEmpty(this.getNotifyUrl()) || StringUtil.isEmpty(this.getOutTradeNo())){
			return false;
		}
		return true;
	}
}
